def inf(support,im_types,ex_types,SC_types): pass #plugin information
def impt(imfl,imSC,debug): pass #import function
def expt(exfl,exSC,debug): pass #export function
#^functions are required for extension modules, but don't have to contain any info

#Common types
import struct as St

def setFile(F):
    global f
    f = F
    
#used for reading
def rhex(this): return this.encode('hex')

def ru8(): return St.unpack(">B", f.read(1))[0]
def rs8(): return St.unpack(">b", f.read(1))[0]
def ru16(): return St.unpack(">H", f.read(2))[0]
def rs16(): return St.unpack(">h", f.read(2))[0]
def ru32(): return St.unpack(">L", f.read(4))[0]
def rs32(): return St.unpack(">l", f.read(4))[0]
def rf(): return St.unpack(">f", f.read(4))[0]

def rbu8(): return St.unpack("<B", f.read(1))[0]
def rbs8(): return St.unpack("<b", f.read(1))[0]
def rbu16(): return St.unpack("<H", f.read(2))[0]
def rbs16(): return St.unpack("<h", f.read(2))[0]
def rbu32(): return St.unpack("<L", f.read(4))[0]
def rbs32(): return St.unpack("<l", f.read(4))[0]
def rbf(): return St.unpack("<f", f.read(4))[0]

#used for writing
def wu8(this): return St.pack(">B", f.write(this))[0]
def ws8(this): return St.pack(">b", f.write(this))[0]
def wu16(this): return St.pack(">H", f.write(this))[0:2]
def ws16(this): return St.pack(">h", f.write(this))[0:2]
def wu32(this): return St.pack(">L", f.write(this))[0:4]
def ws32(this): return St.pack(">l", f.write(this))[0:4]
def wf(this): return St.pack(">f", f.write(this))[0:4]

def wbu8(this): return St.pack("<B", f.write(this))[0]
def wbs8(this): return St.pack("<b", f.write(this))[0]
def wbu16(this): return St.pack("<H", f.write(this))[0:2]
def wbs16(this): return St.pack("<h", f.write(this))[0:2]
def wbu32(this): return St.pack("<L", f.write(this))[0:4]
def wbs32(this): return St.pack("<l", f.write(this))[0:4]
def wbf(this): return St.pack("<f", f.write(this))[0:4]
